<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateArticleModelsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('article_models', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->string('source')->nullable()->comment('文章来源');
            $table->string('author')->nullable()->comment('作者');
            $table->string('description')->nullable()->comment('文章简介');
            $table->unsignedInteger('category_id')->comment('所属栏目id');
            $table->string('thumb')->nullable()->comment('缩率图');
            $table->string('user_id')->comment('发布文章的用户id');
            $table->text('content')->comment('文章内容');
            $table->string('redirect_url')->comment('文章跳转地址')->nullable();
            $table->string('clicks')->comment('查看次数')->default(0);
            $table->string('fields')->comment('扩展字段')->nullable();
            $table->string('article_template')->nullable()->comment('文章自定义模板');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('article_models');
    }
}
